﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;
public partial class Manage_GoodsTrendList : System.Web.UI.Page, HZ.MBSM.BLL.IPageDescribe
{
    public string TableName, strFields, strConditions, mKey;
    public int Pagesize, PageIndex, PageCount;
    string strSql, delTrendID;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (HZ.MBSM.BLL.Login.CheckAssert(this.UseAccountType))
        {
            if (Request.Form["btnSubmit"] == "删除" && Request.Form["chk"] != null)
            {
                delTrendID = Request.Form["chk"].ToString();
                strSql = "delete from GoodsTrend where TrendID in (" + delTrendID + ")";
                Db db = new Db();
                db.Command(strSql);
                db.Close();
            }
            ShowDate();
        }
    }

    public void ShowDate()
    {
        Db db = new Db();
        DbPage dbPage = new DbPage(db);
        dbPage.Table = "GoodsTrend";                                               //要查询的表明
        dbPage.Key = "TrendID";                                               //表的主键    
        dbPage.Where = fctConditions();                                           //查询条件    
        dbPage.SelectField = "TrendID,Title,AddDate";//要显示的字段
        dbPage.PageIndex = SysFun.ToInt(Request["CurrentlyPageIndex"]);          //要显示第几页   
        dbPage.PageSize = 10;                                                    //没有显示记录条数   
        dbPage.OrderBy = "TrendID ";                  //排序字段
        dbPage.OrderByIsDesc = true;
        System.Data.IDataReader dr = dbPage.ExecuteReader();
        DlInfo.DataSource = dr;
        DlInfo.DataBind();
        dr.Close();
        dr.Dispose();
        dbPage.Db.Close();
        db.Close();
        this.DbPageFlip1.DbPage = dbPage;//将数据传给控键


    }
    /// <summary>
    /// 生成查询条件
    /// </summary>
    /// <returns></returns>
    public string fctConditions()
    {
        string strtemp = "", Title;
        Title = txtTitle.Text.ToString().Trim();
        if (Title != "")
        {
            strtemp = " Title like '%" + Title + "%' ";
        }
        return strtemp;
    }

    /// <summary>
    /// 截取指定长度标题
    /// </summary>
    /// <param name="title"></param>
    /// <returns></returns>
    public string getShow(object title)
    {
        string strTitle = title.ToString();
        if (strTitle.Length > 27)
        {
            strTitle = strTitle.Remove(27) + "...";
        }
        return "&nbsp;" + strTitle;
    }
    #region IPageDescribe 成员

    public string Name
    {
        get { return "药品采购动态 "; }
    }

    public string Describe
    {
        get { return " "; }
    }

    public string ParentName
    {
        get { return "信息发布"; }
    }

    public System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> UseAccountType
    {
        get
        {
            System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
            _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAdmin);
            _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAttorney);
            return _AccountType;
        }
    }

    #endregion
}


